// API响应类型
export interface ApiResponse<T = any> {
  code: number;
  msg: string;
  data: T;
}

// 用户相关类型
export interface User {
  user_id: number;
  nickname: string;
  avatar: string;
  bio: string;
  age?: number;
  gender?: number;
  location?: string;
  interests?: InterestTag[];
}

export interface InterestTag {
  tag_id: number;
  tag_name: string;
  category: string;
}

// 认证相关类型
export interface LoginRequest {
  phone: string;
  password: string;
}

export interface RegisterRequest {
  phone: string;
  password: string;
  code: string;
}

export interface SendSmsRequest {
  phone: string;
}

export interface AuthResponse {
  user_id: number;
  token: string;
}

// 推荐和滑动相关类型
export interface RecommendationUser extends User {
  distance?: number;
  compatibility_score?: number;
}

export interface SwipeRequest {
  user_id: number;
  target_user_id: number;
  action: number; // 1: 喜欢, 2: 无感
}

export interface SwipeResponse {
  is_match: boolean;
  message: string;
  success: boolean;
}

// 匹配相关类型
export interface Match {
  match_id: number;
  user_id: number;
  nickname: string;
  avatar: string;
  bio: string;
  match_time: string;
  interests: InterestTag[];
}

export interface MatchDetail extends Match {
  last_message?: ChatMessage;
  unread_count?: number;
}

// 聊天相关类型
export interface ChatMessage {
  message_id: number;
  user_id: number;
  match_id: number;
  content: string;
  msg_type: number; // 1: 文本, 2: 图片, 3: 语音
  created_at: string;
  is_read: boolean;
}

export interface SendMessageRequest {
  user_id: number;
  match_id: number;
  content: string;
  msg_type: number;
}

// 通知相关类型
export interface Notification {
  notification_id: number;
  user_id: number;
  type: number;
  title: string;
  content: string;
  is_read: boolean;
  created_at: string;
}

// 灵魂匹配相关类型
export interface SoulQuestion {
  question_id: number;
  question_text: string;
  category: string;
  options: string[];
}

export interface SoulAnswer {
  question_id: number;
  answers: string[];
  answer_score: number;
}

export interface SoulMatch {
  target_user_id: number;
  nickname: string;
  avatar: string;
  compatibility_score: number;
  common_answers: number;
}

// LBS相关类型
export interface Location {
  latitude: number;
  longitude: number;
  city: string;
  address: string;
}

export interface UpdateLocationRequest {
  user_id: number;
  latitude: number;
  longitude: number;
  city: string;
  address: string;
}

export interface NearbyUser extends User {
  distance: number;
  latitude: number;
  longitude: number;
}

export interface GetNearbyUsersRequest {
  user_id: number;
  latitude: number;
  longitude: number;
  radius?: number;
}

export interface GetUserLocationRequest {
  user_id: number;
}

// 好友系统类型
export interface FriendInfo {
  user_id: number;
  nickname: string;
  avatar: string;
  remark?: string;
  added_at: number;
}

export interface FriendGroup {
  group_id: number;
  group_name: string;
  sort_order: number;
  friends: FriendInfo[];
}

export interface AddFriendRequest {
  user_id: number;
  target_user_id: number;
  group_id?: number;
  remark?: string;
}

export interface RemoveFriendRequest {
  user_id: number;
  target_user_id: number;
}

export interface CreateFriendGroupRequest {
  user_id: number;
  group_name: string;
}

export interface RenameFriendGroupRequest {
  user_id: number;
  group_id: number;
  group_name: string;
}

export interface DeleteFriendGroupRequest {
  user_id: number;
  group_id: number;
}

export interface MoveFriendToGroupRequest {
  user_id: number;
  target_user_id: number;
  to_group_id: number;
}
